<template>
  <div class="cu-common-layout">
    <div class="cu-common-layout-center">
      <el-row class="cu-common-search-box" :gutter="16">
        <el-form @submit.native.prevent>
          <el-col :span="4">
            <el-form-item label="校区品牌" prop="brand">
              <el-select v-model="query.brand" placeholder="" @change="handleChangeBrand">
                <el-option :key="item.id" :label="item.fullName" :value="item.enCode" v-for="item in brandOptions" />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="校区信息">
              <el-select v-model="query.campusId" placeholder="校区信息" filterable clearable>
                <el-option v-for="(item, index) in campusOptions" :key="index" :label="item.fullName" :value="item.id" />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="积分规则">
              <el-input v-model="query.ruleTitle" clearable :style="{ width: '100%' }" />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item>
              <el-button type="primary" icon="el-icon-search" @click="search()" native-type="submit">{{ $t('common.search') }}</el-button>
              <el-button icon="el-icon-refresh-right" @click="reset()">{{ $t('common.reset') }}</el-button>
            </el-form-item>
          </el-col>
        </el-form>
      </el-row>
      <div class="cu-common-layout-main cu-flex-main">
        <div class="cu-common-head">
          <div></div>
          <div class="cu-common-head-right">
            <el-tooltip effect="dark" content="刷新" placement="top">
              <el-link icon="icon-ym icon-ym-Refresh cu-common-head-icon" :underline="false" @click="reset()" />
            </el-tooltip>
            <screenfull isContainer />
          </div>
        </div>
        <custom-table v-loading="listLoading" :data="list">
          <el-table-column prop="brand" label="加盟品牌" align="center" width="80">
            <template slot-scope="scope">
              {{ scope.row.brand | dynamicCodeText(brandOptions) }}
            </template>
          </el-table-column>
          <el-table-column label="校区" prop="shortName" align="left" min-width="200" show-overflow-tooltip></el-table-column>
          <el-table-column prop="ruleTitle" label="规则标题" align="left" min-width="120" />
          <el-table-column prop="points" label="积分值" align="right" width="80" />
          <el-table-column prop="total" label="总积分" align="right" width="100"></el-table-column>
          <el-table-column prop="campusStatus" label="校区状态" align="center" width="100">
            <template slot-scope="scope">
              <el-tag size="mini" v-if="scope.row.campusStatus == 'preparation'" key="筹备" type="" effect="dark">
                筹备
              </el-tag>
              <el-tag size="mini" v-if="scope.row.campusStatus == 'normal'" key="正常" type="success" effect="dark">
                正常
              </el-tag>
              <el-tag size="mini" v-if="scope.row.campusStatus == 'expires'" key="到期" type="info" effect="dark">
                待续费
              </el-tag>
              <el-tag size="mini" v-else-if="scope.row.campusStatus == 'suspended'" key="暂停" type="warning" effect="dark">
                暂停
              </el-tag>
              <el-tag size="mini" v-else-if="scope.row.campusStatus == 'close'" key="闭校" type="danger" effect="dark">
                闭校
              </el-tag>
            </template>
          </el-table-column>
          <el-table-column prop="type" label="操作类型" align="center" width="100">
            <template slot-scope="scope">
              {{ scope.row.type | dynamicText(typeOptions) }}
            </template>
          </el-table-column>
          <el-table-column prop="createTime" label="操作时间" :formatter="custom.tableDateTimeFormat" align="center" width="140" />
          <el-table-column prop="createUserName" label="操作人" width="80" />
          <el-table-column prop="memo" label="备注" align="center" min-width="150" />
        </custom-table>
        <pagination :total="total" :page.sync="listQuery.currentPage" :limit.sync="listQuery.pageSize" @pagination="initData" />
      </div>
    </div>
  </div>
</template>
<script>
export { default } from './index.js'
</script>
<style lang="scss" scoped>
@import url(index.scss);
</style>
